/*This file is part of PaperBall.

PaperBall is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PaperBall is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PaperBall.  If not, see <http://www.gnu.org/licenses/>.*/

package com.ran3000.paperball;

import com.ran3000.paperball.framework.Sound;
import com.ran3000.paperball.framework.gl.Animation;
import com.ran3000.paperball.framework.gl.Font;
import com.ran3000.paperball.framework.gl.Texture;
import com.ran3000.paperball.framework.gl.TextureRegion;
import com.ran3000.paperball.framework.impl.GLGame;

public class Assets {
	
	Ball ball;
	
	public static Texture items;
	public static TextureRegion background;
	public static TextureRegion trasparency;
	public static TextureRegion playButton;
	public static TextureRegion highscoresButton;
	public static TextureRegion exitButton;
	public static TextureRegion exitCircle;
	public static TextureRegion retryButton;
	public static TextureRegion pauseButton;
	public static TextureRegion ready;
	public static TextureRegion gameOver;
	public static TextureRegion logo;
	public static TextureRegion paperBall;
	public static TextureRegion background2;
	public static TextureRegion computer;
	public static TextureRegion shield;
	public static Font font;
	public static Animation snow;
	public static Animation bomb;
	public static Animation explosion;
	public static Animation ice;
	
	public static Sound clickSound;
	public static Sound explosionSound;
	public static Sound startSound;
	
	public static void load(GLGame game) {
		items = new Texture(game, "items.png");
		background = new TextureRegion(items, 1, 215, 480, 320);
		trasparency = new TextureRegion(items, 965, 491, 480, 320);
		logo = new TextureRegion(items, 462, 1, 300, 212);
		ready = new TextureRegion(items, 965, 393, 225, 96);
		paperBall = new TextureRegion(items, 1251, 323, 72, 72);
		explosion = new Animation(0.2f,
				new TextureRegion(items, 912, 75, 72, 72),
				new TextureRegion(items, 838, 75, 72, 72),
				new TextureRegion(items, 764, 75, 72, 72),
				new TextureRegion(items, 360, 75, 72, 72),
				new TextureRegion(items, 838, 140, 72, 72));
		playButton = new TextureRegion(items, 1375, 323, 150, 68);
		pauseButton = new TextureRegion(items, 1325, 323, 48, 48);
		gameOver = new TextureRegion(items, 1, 149, 196, 50);
		highscoresButton = new TextureRegion(items, 483, 537, 150, 68);
		exitCircle = new TextureRegion(items, 51, 75, 48, 48);
		bomb = new Animation(0.2f,
				new TextureRegion(items, 764, 1, 48, 72),
				new TextureRegion(items, 814, 1, 48, 72),
				new TextureRegion(items, 864, 1, 48, 72),
				new TextureRegion(items, 914, 1, 48, 72),
				new TextureRegion(items, 964, 1, 48, 72),
				new TextureRegion(items, 1014, 1, 48, 72),
				new TextureRegion(items, 1, 75, 48, 72));
		retryButton = new TextureRegion(items, 360, 1, 100, 34);
		exitButton = new TextureRegion(items, 1, 1, 100, 34);
		shield = new TextureRegion(items, 1325, 393, 72, 72);
		background2 = new TextureRegion(items, 483, 215, 480, 320);
		computer = new  TextureRegion(items, 1, 537, 480, 320);
		snow = new Animation(0.5f,
				new TextureRegion(items, 483, 604, 480, 320),
				new TextureRegion(items, 1092, 1, 480, 320));
		ice = new Animation(0.2f,
				new TextureRegion(items, 986, 75, 72, 72),
				new TextureRegion(items, 965, 149, 72, 72),
				new TextureRegion(items, 965, 232, 72, 72),
				new TextureRegion(items, 965, 297, 72, 72));
		
		clickSound = game.getAudio().newSound("select.ogg");
		explosionSound = game.getAudio().newSound("explosion.ogg");
		startSound = game.getAudio().newSound("ready.ogg");
		
		font = new Font(items, 103, 1, 16, 16, 20);
	}
	
	public static void reload() {
		items.reload();
	}
	
	public static void playSound(Sound sound) {
		sound.play(1);
	}
}
